import 'package:app/common/colors.dart';
import 'package:app/common/tool.dart';
import 'package:app/components/base_scaffold_appbar.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'leave_detail_controller.dart';

class LeaveDetailView extends GetView{

  LeaveDetailController controller = Get.put(LeaveDetailController());


  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: BaseAppBar(
        preferredSize: Size(Get.width, AppTool.appBarHEIGHT),
        child: Text('请假详情'),
      ),
      body: GetBuilder<LeaveDetailController>(builder: (_){
        return ListView(
          padding: EdgeInsets.all(10),
          children: [
            Text('描述：${controller.model?.data?.name}'),
            Text('请假人：${controller.model?.data?.userName}'),
            Text('请假类型：${controller.model?.data?.typeName}'),
            Text('开始日期：${controller.model?.data?.dateStart}'),
            Text('结束日期：${controller.model?.data?.dateEnd}'),
            Text('持续时间：${controller.model?.data?.duration}'),
            Text('开始时间：${controller.model?.data?.hourFrom}'),
            Text('结束时间：${controller.model?.data?.hourTo}'),



            Text('请假状态：${controller.model?.data?.state=='draft'?'待提交':
            controller.model?.data?.state=='confirm'?'待批准':'已拒绝'}',
              style: TextStyle(color: AppColor.themeColor),),


            controller.model?.data?.isFocus==false?Text('是否关注：否'):Text('是否关注：是'),

            Align(
              alignment: Alignment.centerLeft,
              child: MaterialButton(onPressed: (){
                controller.requestDataCancelLeave();
              },child: Text('撤销',style: TextStyle(color: Colors.white),),color:AppColor.themeColor,),
            )
          ],
        );
      }),
    );
  }

}